import Vue from 'vue'
import Router from 'vue-router'
import VueRouter from 'vue-router'
import Home from '../views/home/Home.vue'
import Predict from '../views/predict/Predict'

/*const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}*/

//Vue.use(Router)
Vue.use(VueRouter)

/*export default new Router({})*/

const routes = [
  /*{
    path: '/',
    name: 'HelloWorld',
    component: HelloWorld
  }*/
  {
    path: '/',
    name: 'menuDemo',
    //redirect: '/home',
    component: () => import('../views/home/MenuDemo.vue'),
    children:[
      {
        path: '/home',
        name: 'Home',
        component: Home,
        meta: {title: '主页'}
      },
      {
        path: '/predict',
        name: 'Predict',
        component: Predict,
        meta: {title: '预测'}
      },
      {
        path: '/faultDiagnosis',
        name: 'FaultDiagnosis',
        component: () => import('../views/faultdiagnosis/FaultDiagnosis.vue'),
        meta: {title: '故障诊断与分析'}
      },
      {
        path: '/systemOverview',
        name: 'SystemOverview',
        component: () => import('../views/systemoverview/SystemOverview'),
        meta: {title: '系统总览'}
      },
      {
        path: '/multiDeviceOverview',
        name: 'MultiDeviceOverview',
        component: () => import('../views/multideviceoverview/MultiDeviceOverview'),
        meta: {title: '多设备概览'}
      },
      {
        path: '/faultWarning',
        name: 'FaultWarning',
        component: () => import('../views/faultwarning/FaultWarning'),
        meta: {title: '故障预警'}
      },
      {
        path: '/faultAlarm',
        name: 'FaultAlarm',
        component: () => import('../views/faultalarm/FaultAlarm'),
        meta: {title: '故障报警'}
      },
      {
        path: '/maintenanceAdvice',
        name: 'MaintenanceAdvice',
        component: () => import('../views/maintenanceadvice/MaintenanceAdvice'),
        meta: {title: '维护建议'}
      },
    ]
  }
]

const router = new VueRouter({
  routes
})

export default {router, routes}
